package thinkinjava4.ch18_io;

import java.io.*;

/**
 * 基本文件输出
 */
public class BasicFileOutput {
    private static String fileBaseUrl = "src/thinkinjava4/ch18_io/";
    static String file = "BasicFileOutput.out";

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(
                new StringReader(BufferedInputFile.read("BasicFileOutput.java")));
        PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(fileBaseUrl + file)));
        int lineCount = 1;
        String s;
        while ((s = in.readLine()) != null)
            out.printf("%2d%s", lineCount++, ": " + s + "\n");
        out.close();
        System.out.println(BufferedInputFile.read(file));
    }
}
